package com.jmhy.sdk.utils;

import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;

import com.jmhy.sdk.config.AppConfig;
import com.jmhy.sdk.fragment.JmPhonerLogin2Fragment;
import com.jmhy.sdk.fragment.JmPhonerLogin3Fragment;
import com.jmhy.sdk.fragment.JmPhonerLogin4Fragment;
import com.jmhy.sdk.fragment.JmPhonerLogin5Fragment;
import com.jmhy.sdk.fragment.JmPhonerLogin6Fragment;
import com.jmhy.sdk.fragment.JmPhonerLoginFragment;
import com.jmhy.sdk.fragment.JmSetUser2Fragment;
import com.jmhy.sdk.fragment.JmSetUser3Fragment;
import com.jmhy.sdk.fragment.JmSetUser8Fragment;
import com.jmhy.sdk.fragment.JmSetUserFragment;
import com.jmhy.sdk.fragment.JmSetpwd2Fragment;
import com.jmhy.sdk.fragment.JmSetpwd3Fragment;
import com.jmhy.sdk.fragment.JmSetpwd4Fragment;
import com.jmhy.sdk.fragment.JmSetpwdFragment;
import com.jmhy.sdk.fragment.JmUserLogin2Fragment;
import com.jmhy.sdk.fragment.JmUserLogin3Fragment;
import com.jmhy.sdk.fragment.JmUserLogin4Fragment;
import com.jmhy.sdk.fragment.JmUserLoginFragment;
import com.jmhy.sdk.fragment.JmUserLoginOrRegAccountFragment8;
import com.jmhy.sdk.fragment.JmUserMobileLogin8Fragment;
import com.jmhy.sdk.fragment.JmUserRegister2Fragment;
import com.jmhy.sdk.fragment.JmUserRegister3Fragment;
import com.jmhy.sdk.fragment.JmUserRegister8Fragment;
import com.jmhy.sdk.fragment.JmUserRegisterFragment;
import com.jmhy.sdk.fragment.JmUserRegisterFragment8;
import com.jmhy.sdk.fragment.JmUserSelectLoginAccountFragment8;
import com.jmhy.sdk.fragment.JmUserSelectLoginFragment8;
import com.jmhy.sdk.fragment.JmUserSetGuestPswFragment8;

/**
 * create by yhz on 2018/8/21
 */
public class FragmentUtils {
    public static Fragment getJmPhonerLoginFragment(Context context) {
        switch (AppConfig.skin) {

            case 8:

                return getJmAccountLoginFragment(context);
            case 7:
                return Fragment.instantiate(context, JmPhonerLogin2Fragment.class.getName());
            case 6:
                return Fragment.instantiate(context, JmPhonerLogin6Fragment.class.getName());
            case 5:
                return Fragment.instantiate(context, JmPhonerLogin5Fragment.class.getName());
            case 4:
                return Fragment.instantiate(context, JmPhonerLogin4Fragment.class.getName());
            case 3:
                return Fragment.instantiate(context, JmPhonerLogin3Fragment.class.getName());
            case 2:
                return Fragment.instantiate(context, JmPhonerLogin2Fragment.class.getName());
            default:
                return Fragment.instantiate(context, JmPhonerLoginFragment.class.getName());
        }
    }

    public static Fragment getJmUserLoginFragment(Context context) {
        switch (AppConfig.skin) {
            case 8:

                return getJmAccountLoginFragment(context);
            case 7:
                return Fragment.instantiate(context, JmUserLogin2Fragment.class.getName());
            case 6:
                return Fragment.instantiate(context, JmPhonerLogin6Fragment.class.getName());
            case 5:
            case 4:
                return Fragment.instantiate(context, JmUserLogin4Fragment.class.getName());
            case 3:
                return Fragment.instantiate(context, JmUserLogin3Fragment.class.getName());
            case 2:
                return Fragment.instantiate(context, JmUserLogin2Fragment.class.getName());
            default:
                return Fragment.instantiate(context, JmUserLoginFragment.class.getName());
        }
    }

    public static Fragment getJmSetpwdFragment(Context context, Bundle args) {
        switch (AppConfig.skin) {
            case 9:
                return Fragment.instantiate(context, JmSetpwd2Fragment.class.getName(), args);
            case 8:
                return Fragment.instantiate(context, JmSetpwd2Fragment.class.getName(), args);
            case 7:
                return Fragment.instantiate(context, JmSetpwd2Fragment.class.getName(), args);
            case 6:
            case 5:
            case 4:
                return Fragment.instantiate(context, JmSetpwd4Fragment.class.getName(), args);
            case 3:
                return Fragment.instantiate(context, JmSetpwd3Fragment.class.getName(), args);
            case 2:
                return Fragment.instantiate(context, JmSetpwd2Fragment.class.getName(), args);
            default:
                return Fragment.instantiate(context, JmSetpwdFragment.class.getName(), args);
        }
    }

    public static Fragment getJmSetUserFragment(Context context, Bundle args) {
        switch (AppConfig.skin) {
            case 9:

                return Fragment.instantiate(context, JmSetUser8Fragment.class.getName(), args);
            case 8:
                return Fragment.instantiate(context, JmUserSetGuestPswFragment8.class.getName(), args);
            case 7:
                return Fragment.instantiate(context, JmSetUser2Fragment.class.getName(), args);

            case 3:
                return Fragment.instantiate(context, JmSetUser3Fragment.class.getName(), args);
            case 2:
                return Fragment.instantiate(context, JmSetUser2Fragment.class.getName(), args);
            default:
                return Fragment.instantiate(context, JmSetUserFragment.class.getName(), args);
        }
    }

    public static Fragment getJmUserRegisterFragment(Context context) {
        switch (AppConfig.skin) {
            case 9:
                return Fragment.instantiate(context, JmUserRegister8Fragment.class.getName());
            case 8:
                return Fragment.instantiate(context, JmUserRegister8Fragment.class.getName());
            case 7:
                return Fragment.instantiate(context, JmUserRegister2Fragment.class.getName());
            case 5:
                return Fragment.instantiate(context, JmPhonerLogin5Fragment.class.getName());
            case 4:
                return Fragment.instantiate(context, JmPhonerLogin4Fragment.class.getName());
            case 3:
                return Fragment.instantiate(context, JmUserRegister3Fragment.class.getName());
            case 2:
                return Fragment.instantiate(context, JmUserRegister2Fragment.class.getName());
            default:
                return Fragment.instantiate(context, JmUserRegisterFragment.class.getName());
        }

    }

    public static Fragment getJmAccountLoginFragment(Context context) {
        Seference seference = new Seference(context);
        if (seference.isExitData()) {
            return getJmSkin8Fragment(context, SDK_SELECT_ACCOUNT_TAG);
        } else {
            return getJmSkin8Fragment(context, SDK_SELECT_LOGIN_TYPE_TAG);
        }
    }


    public static final int SDK_REGISTER_TAG = 1;
    public static final int SDK_LOGIN_TAG = 2;
    public static final int SDK_PHONE_REGISTER_TAG = 3;
    public static final int SDK_QUICK_LOGIN = 4;
    public static final int SDK_KEFU = 5;
    public static final int SDK_FOTGOT_PWD_TAG = 6;
    public static final int SDK_PROCOTOL_TAG = 7;
    public static final int SDK_SELECT_ACCOUNT_TAG = 8;
    public static final int SDK_SELECT_LOGIN_TYPE_TAG = 9;
    public static final int SDK_GUEST_SET_PWD_TAG = 10;
    public static final int SDK_MOBILE_LOGIN_TAG = 11;

    public static Fragment getJmSkin8Fragment(Context context, int type) {
        switch (type) {
            case SDK_REGISTER_TAG:
                return Fragment.instantiate(context, JmUserRegisterFragment8.class.getName());
            case SDK_LOGIN_TAG:
                return Fragment.instantiate(context, JmUserLoginOrRegAccountFragment8.class.getName());
            case SDK_SELECT_ACCOUNT_TAG:
                return Fragment.instantiate(context, JmUserSelectLoginAccountFragment8.class.getName());
            case SDK_SELECT_LOGIN_TYPE_TAG:
                return Fragment.instantiate(context, JmUserSelectLoginFragment8.class.getName());
            case SDK_GUEST_SET_PWD_TAG:
                return Fragment.instantiate(context, JmUserSetGuestPswFragment8.class.getName());
            case SDK_MOBILE_LOGIN_TAG:
                return Fragment.instantiate(context, JmUserMobileLogin8Fragment.class.getName());
            default:
                return Fragment.instantiate(context, JmUserRegisterFragment.class.getName());
        }
    }

}
